//
//  MyCirularDiagram.swift
//  SwiftUIShape
//
//  Created by 李煜 on 2024/8/1.
//

import SwiftUI
// 练习
struct MyCirularDiagram: View {
  var body: some View {
    ZStack {
      Circle()
        .trim(from: 0, to: 0.3)
        .stroke(.purple, lineWidth: 60)
      Circle()
        .trim(from: 0.3, to: 0.7)
        .stroke(Color.indigo, lineWidth: 60)
      Circle()
        .trim(from: 0.7, to: 1)
        .stroke(.orange, lineWidth: 70)
        .offset(x: 5, y: -5)
        .overlay(alignment: .topTrailing) {
          Text("30%")
            .foregroundStyle(.white)
            .font(.system(size: 30))
            .fontDesign(.rounded)
            .fontWeight(.black)
            .offset(x: -30)
        }
    }
    .padding(50)
  }
}

#Preview {
  MyCirularDiagram()
}
